System to profile and optimize user software in a managed run-time environment

ABSTRACT

Method, apparatus, and system for monitoring performance within a processing resource, which may be used to modify user-level software. Some embodiments of the invention pertain to an architecture to allow a user to improve software running on a processing resources on a per-thread basis in real-time and without incurring significant processing overhead.

BACKGROUND

1. Field

The present disclosure pertains to the field of processing apparatusesand systems that process sequences of instructions or the like, as wellas certain instruction sequences to program such apparatuses and/orsystems. Some embodiments relate to monitoring and/or responding toconditions or events within execution resources of such processingapparatuses.

2. Description of Related Art

Various mechanisms are presently used to monitor and profile a softwareprogram activity, including instrumentation and system-level profiling.Software instrumentation is a technique that requires the modificationof the software, either during compilation or while in post-compiled(“binary”) form, by inserting codes at points where a developer wouldlike to see the progress (e.g., output, processor state, etc.) of thesoftware.

Instrumentation may be undesirable in certain circumstances, asinstrumentation typically requires a non-trivial amount of code to beadded to an instrumented program, which can result in significantperformance overhead when executing the instrumented program. As aresult, a delay may occur between the time when an event occurs and thetime that the event is actually detected and associated with aparticular operation within the code. This delay may make it difficultto accurately discern the operation or operations causing the event,which makes efforts to avoid or improve the event difficult, if notimpossible. Lastly, instrumentation may be undesirable if it requiresthe instrumented program to be recompiled before the instrumented codeis executed.

As a result, managed run-time environments, such as the Microsoft® .Net™developer environment, may not typically support instrumentation for thedevelopment of production-quality software.

Although prior art system-level profiling techniques can be used toprofile and optimize software during run-time, these techniquestypically require a developer to use operating system functions (e.g.,application program interface, or “API”) to monitor or profile theuser-level software, which may result in performance overhead.Accordingly, a user may not be able to obtain the true performanceprofile of a particular program and optimize his software accordinglydue to the possible operating system-imposed time lag and lack ofprecision between when an event occurs within a processor executing hissoftware and when an event is recorded and becomes visible through theprofiling interface. Furthermore, typical system-level profilingtechniques typically do not allow a developer to profile or optimizesoftware on a per-thread basis.

Multi-threading is a technique by which processor hardware may beutilized by multiple different threads. Multi-threaded processors mayswitch between threads for a variety of reasons. For example, aprocessor may have an algorithm that automatically switches betweenavailable threads. Other processors use switch-on-event multithreading(SoEMT), whereby certain events such as a cache miss may give rise to athread switch. Thread switching can be considered a change of controlflow because the processor switches the sequence or stream which itexecutes.

In any case, system-level profiling techniques are typically not able tomodify, profile, or optimize a particular thread or threads of auser-level program and may incur significant processing overhead,preventing a developer from optimizing user-level programs. Furthermore,prior art instrumentation techniques may not allow a developer tomodify, profile, or optimize user-level programs during run-time, or mayincur significant processing overhead, further exacerbating the problemof optimizing the user-level code.

BRIEF DESCRIPTION OF THE FIGURES

The present invention is illustrated by way of example and notlimitation in the Figures of the accompanying drawings.

FIG. 1 illustrates one embodiment of a system to monitor various eventswithin a processor.

FIG. 2 illustrates a flow diagram of operations for one embodiment ofthe system of FIG. 1.

FIG. 3 illustrates a flow diagram of operations for another embodimentof the system of FIG. 1.

FIG. 4 illustrates another embodiment of a system that can respond tomultiple different performance events and/or to composite performanceevents.

FIG. 5 a illustrates one embodiment of a monitor that may recognizecomposite events.

FIG. 5 b illustrates another embodiment of a monitor.

FIG. 5 c illustrates another embodiment of a monitor.

FIG. 6 is a block diagram illustrating certain details for at least oneembodiment of a system that can detect and respond toarchitecturally-defined processing conditions of execution resources.

FIG. 7 is an architecture to detect performance events within aprocessing resource and to modify user-level software in responsethereto, according to one embodiment.

DETAILED DESCRIPTION

The following description describes embodiments of a system to profileand optimize user software in a managed run-time environment responsiveto detection of one or more user-selected architecturally-definedprocessor conditions. In the following description, numerous specificdetails such as processor types, microarchitectural conditions, events,enablement mechanisms, and the like are set forth in order to provide amore thorough understanding of the present invention. It will beappreciated, however, by one skilled in the art that the invention maybe practiced without such specific details. Additionally, some wellknown structures, circuits, and the like have not been shown in detailto avoid unnecessarily obscuring the present invention.

In some embodiments, disclosed techniques may allow a program toactively monitor and respond to conditions of the execution resourceswhich execute the program while executing the program. Effectively, suchembodiments may incorporate real-time execution resource operatingcondition feedback to improve performance. If the execution resourcesencounter execution delaying conditions, the program execution may bedisrupted to make adjustments. In some embodiments, a handler may beactivated and may spawn a service thread to attempt to improve executionof the original thread. In other embodiments, the disruption may beaccomplished by switching to another program thread that may not be aservice thread. These and other embodiments may in some casesadvantageously improve processing throughput and/or allow optimizationsto be tailored to particular hardware.

Turning to FIG. 1, one embodiment of a system that can monitorconditions of execution resources is illustrated. In the embodiment ofFIG. 1, execution resources 105, a monitor 110, and enable logic 120form a portion of a processor 100 that is capable of executinginstructions. The execution resources may include hardware resourcesthat may be integrated into a single component or integrated circuit insome embodiments. However the execution resources may include softwareor firmware resources or any combination of hardware and software and/orfirmware that may also be used in execution of program instructions. Forexample, firmware may be used as a part of an abstraction layer or mayadd functions to processing hardware, as may software. Software also maybe used to emulate part or all of an instruction set or to otherwiseassist in processing.

The processor may be any of a variety of different types of processorsthat execute instructions. For example, the processor may be a generalpurpose processor such as a processor in the Pentium® Processor Familyor the Itanium® Processor Family or other processor families from IntelCorporation or other processors from other companies. Thus, theprocessor may be a reduced instruction set computing (RISC) processor, acomplex instruction set computing (CISC) processor, a very longinstruction word (VLIW) processor, or any hybrid or alternativeprocessor type. Moreover, special purpose processors such as network orcommunication processors, co-processors, embedded processors,compression engines, graphics processors, etc., may use disclosedtechniques. As integration trends continue and processors become evenmore complex, the need to monitor and react to internal performanceindicators may further increase, thus making presently disclosedtechniques more desirable. However, due to rapid technological advancein this area of technology, it is difficult to foresee all theapplications of disclosed technology, though they may be widespread forcomplex hardware that executes program sequences.

As shown in FIG. 1, the processor 100 is coupled to a storage medium 150such as a memory. The storage medium 150 may be a memory subsystemhaving various levels of hierarchy which may include but are not limitedto various levels of cache memory, system memory such as dynamic randomaccess memory or the like, and non-volatile storage such as flash memory(e.g. memory stick etc), a magnetic or optical disk. As illustrated, thestorage medium stores a program 160 and a handler and/or other threadinstructions such as instructions for a service thread 170. Furthermore,the memory may store a managed run-time environment 155 in which aprogram thread or threads may be developed and optimized in response tomonitoring various events within the execution resources.

To allow the monitor 110 to monitor the desired events, the monitor 110may be coupled to various portions of execution resources in order todetect particular conditions or to be informed of certainmicroarchitectural events. Signal lines may be routed to the monitor110, or the monitor may be strategically placed with or integrated withrelevant resources. The monitor 110 may include various programmablelogic or software or firmware elements. For at least one embodiment, themonitor 110 may be programmed to monitor one or more architectural ormicroarchitectural events that are associated witharchitecturally-defined event combinations, or “scenarios”, that may beused to trigger a yield event. Alternatively, the monitor 110 may behardwired to detect a particular condition or set of conditionsassociated with a scenario.

Accordingly, the system illustrated in FIG. 1 may support one or morearchitectural events called yield events. The yield events transfer theexecution from the currently running instruction stream to the channel'syield event service routine. The channel's service routine belongs tothe same process/context of the currently running instruction stream.The yield event is signaled when the scenario associated with thechannel triggers.

The monitor 110 tracks the various events or conditions, and if theevents or conditions it is programmed to detect occur, then theexecution resources 105 are signaled to disrupt the normal control flowthe program would otherwise follow. As indicated in FIG. 1, thedisruption may result in an event handler being called or a threadswitch occurring. For at least one alternative embodiment, a disruptionof the normal control flow of the program is not necessarily triggeredif the events or conditions monitored by the monitor 110 occur. Instead,one or more of a group of architectural states, called channels 1300,may be utilized to indicate whether a yield event should occur when allconditions for a scenario are detected by the monitor 110. That is, thechannel may be programmed so that, when a scenario is detected, a yieldevent will occur. Without such indication in the channel, thesatisfaction of a scenario, though detected, may not cause a yieldevent.

The processor 100 illustrated in FIG. 1 thus includes a set ofarchitecture states called channels 1300. Each channel specifies atrigger-action mapping. The trigger is the scenario that is associatedwith the channel. Response to occurrence of the scenario, a yield eventhandler may record the occurrence and respond by invoking a serviceroutine, such as channel service handler 185 illustrated in FIG. 1. Theyield event handler may be a hardware, firmware, or software mechanism.

In addition, at least one embodiment of the processor 100 may alsoinclude a yield block indicator (“BI”), 1380. The value of the BI 1380may provide an override function. That is, the value of the BI 1380indicates whether, despite a channel that indicates that a yield eventshould occur upon occurrence of a scenario, the yield event should notbe taken. For at least one embodiment, the BI 1380 includes a field foreach ring level of privilege. Thus, the BI 1380 may be a register or setof registers.

One example of a specific detectable condition is that data may bemissing from a cache memory, resulting in the event of a cache missoccurring. In fact, a program may generate a pattern of memory accessesthat causes repeated cache misses, thereby degrading performance. Suchan occurrence of a certain number of cache misses within a period oftime or during execution of a portion of code is one example of ascenario that indicates a relatively low level of progress is being madein executing that section of code. The monitor 110 may be programmed tomonitor for and detect that this or other detectable conditions haveoccurred, or have occurred a certain number of times.

Other detectable events which may be low progress indicators may relateto various other microarchitectural or structural details of theexecution resources. A monitor may detect a condition involving one ormore of a stall of a resource, a cache event, a retirement event, abranch or branch prediction result, an exception, a bus event, or avariety of other commonly monitored or performance-impacting events orconditions. The monitor 110 may count or otherwise time, quantify, orcharacterize such events or conditions, and may be programmable when aparticular metric associated with one or more events or conditionsoccurs. Furthermore, one or more events of detected by the monitor maybe logically combined or accumulated to define a scenario or scenariosthat may be triggered and detected to further provide performancefeedback to allow a user to further optimize his or her user-levelsoftware programs on a per-thread basis at run-time.

FIG. 1 illustrates that the storage medium 150 may also include anoperating system (“OS”) 180 as well as the channel service handlermechanism 185. For at least one embodiment, the operating system 180 maybe minimally involved in the user-level thread monitoring andoptimization techniques described herein. For example, the OS 180 may beinvolved in saving and restoring contexts during yield event processing.The operating system 180 may thus provide context management services.The channel states may be part of the context that the OS 180 manages.

For at least one embodiment, however, the OS 180 is not involved withdelivering the yield event. For such embodiment, the satisfaction of aprogrammed scenario (that is, a combination of events that have beenprogrammed into a channel in order to trigger a yield event) triggers ayield event that is delivered via the yield event handler in hardware orfirmware. For at least one embodiment, for example, the instructiontriggering satisfaction of the scenario may be tagged, via hardware.Such tag may be processed in order to deliver the yield event. Suchprocessing may occur, for example, in hardware or firmware, such asmicrocode ROM instructions, of the execution resources 105. Thishardware or firmware mechanism that effects transfer of control for ayield event is sometimes referred to herein as the “yield eventhandler.”

Control may be transferred, via the yield event handler, to the channelservice handler 185. In this manner, processing for an architecturally-defined scenario may be performed directly by user-level code withminimal intervention of the OS 180. Scenario condition detection andyield event delivery (including control transfer) are transparent to theOS 180 for such an embodiment.

For at least one other embodiment, however, satisfaction of a scenariomay trigger an internally-generated software interrupt rather thantriggering a hardware-delivered yield event as discussed above. For suchembodiment, the operating system 180 may invoke the channel servicehandler 185 when a yield event software interrupt occurs.

Regardless of how the yield event is delivered (hardware vs. software),the yield event may be handled by user-level code. That is, under eitherapproach control may be transferred to the channel service handler 185,which may, in effect, transfer control to a user-defined service threador handler responsive to detection of the trigger condition. Thiscontrol transfer disrupts execution of the current instruction streamthat was executing when the yield event occurred. The user-definedservice thread or handler may include routines to optimize the threadsthat caused a scenario to be triggered, in one embodiment. Furthermore,in one embodiment, the user-defined service thread or handler may beused to optimize user-level programs causing a scenario trigger within amanaged run-time environment, such that optimizations may be made inreal-time.

FIG. 2 illustrates a flow diagram of operations for one embodiment ofthe system of FIG. 1. As indicated in block 200 of FIG. 2, the program160 may set events or scenarios to monitor within processing resourcesin which the program is being executed. For example, the enablementlogic 120 may control both activation of the monitor and which event(s)to detect. Accordingly, at block 200 the program 160 may invoke theenablement logic 120 to activate the monitor 110 to detect one or moremicroarchitectural or architectural processor events or scenarios.Alternatively, the enablement logic 120 may enable and/or mask events,and the monitor 110 may itself also be programmable for furtherflexibility in specifying the events or conditions within the executionresources or system that are tracked. In either case, the program 160itself may specify conditions that are to be watched during its ownexecution.

For example, the program 160 may be a program that includes a mainthread that invokes the enablement logic 120 to indicate that themonitor 110 should monitor for a particular scenario. The scenario mayinclude a single “raw event” or, alternatively, may be a compositescenario that includes two or more raw events. For at least one otherembodiment, however, the hardware of the monitor 110 is dedicated, or“hardwired”, to monitor for certain raw events.

The program 160 may also, at block 200, modify one or more of thechannels 1300 to indicate the handler or thread 170 which is to beactivated when the monitored condition(s) occur. For example, theprogram 160 may be a program which includes a main thread and a servicethread or service routine that attempts to improve execution of the mainthread if conditions the program specifies occur. The main thread mayinclude an EMONITOR-type instruction (discussed below) to map a handlerto the monitored condition(s).

As indicated in block 205, the program instructions are executed.Execution of the program causes the state of the execution resources tochange. For example, a variety of conditions may occur or be presentthat inhibit forward progress in execution of the program. As indicatedin block 210, the various processing metrics and/or microarchitecturalconditions may be monitored to determine if the triggering eventprogrammed in block 200 occurs. If the triggering state does not occurin block 210, disruption of processing is not triggered, and programexecution continues by returning to block 205.

In some cases, the triggering state bears only an indirect relationshipto execution of any single instruction. For example, a prior artinstrumentation technique typically causes a break when an instructionpointer reaches a designed address. Such breakpoints are precise becausea particular instruction (i.e., its address) directly triggers thebreak. Also, the prior art quiesce instruction itself causes a thread tostop at least temporarily. In contrast, some embodiments utilizingdisclosed techniques trigger control flow changes on a set of conditionsthat are not necessarily caused by a single instruction, but rather maybe caused by the overall program flow and/or system environment. Thus,while the monitor may repeatedly trigger at the same instructionexecution state in a single system, other conditions, environments,system, etc., may cause different trigger points for the same program.In this sense, disclosed techniques, in some cases, provide an impreciseor asynchronous mechanism generating a control flow change that is notdirectly tied to an instruction execution boundary. Moreover, such animprecise mechanism may, in some embodiments, test for events at a lessfine granularity than each instruction and/or may delay recognition ofevents for some period of time because architectural correctness doesnot depend on any processing-rate-enhancing service routines executingat any particular point in time.

When a single or composite set of conditions associated with a scenariois detected by the monitor in block 210, processing of the program maybe disrupted as indicated in block 215. Whether or not disruption 215occurs is governed by the current contents of the channels 1300. If thedetected scenario has been mapped to a handler or other thread 170, thendisruption processing 215 may be executed. If a channel indicates thatsuch disruption should be triggered, processing proceeds to block 215.Otherwise, processing loops back to block 205.

Generally, at block 215 the system may responsively adjust becauseprocessing of the program is occurring inefficiently or in a mannerother than the manner the programmer desired. For example, anothersoftware routine such as another program portion may be invoked. Theother program portion may be another thread unrelated to the originalthread or may be a service thread that helps (“helper thread”) executethe original thread, for example by prefetching data to reduce cachemisses. Alternatively, a program-transparent (e.g., hardware) mechanismmay perform some optimizations, reconfiguration (including, but notlimited to reconfiguration of the monitor setup), reallocation ofresources or the like to hopefully improve processing.

FIG. 4 illustrates another embodiment of a system that can respond tomultiple different performance events and/or to composite performanceevents (e.g., scenarios). In the embodiment of FIG. 4, executionresources 400 are shown as including a set of N monitors 410-1 through410-N. Additionally, an event schema vector (ESV) storage location 420and an event schema vector mask (ESVM) storage location 425 areprovided. The embodiment of FIG. 4 shows a number of monitors (N)corresponding to the number of bits in the event schema vector and theevent schema mask vector. In other embodiments, there may be differentnumbers of monitors and bits in these vectors, and the monitors may ormay not correlate directly to the bits. For example, a conditioninvolving multiple monitors may correlate to a single vector bit in someembodiments.

The execution resources 400 are optionally coupled to an eventdescriptor table 430 (EDT), which may be locally implemented on theprocessor or in a co-processor or system memory. Control flow logic 435is coupled the monitors 410-1 through 410-N and to receive values fromthe event schema vector and the event schema vector mask. The controlflow logic 435 changes the control flow for processing logic when acondition detected by one or more of the monitors is enabled accordingto the event schema vector and event schema vector mask.

The embodiment of FIG. 4 also illustrates decode logic 402 and a set ofmachine or model specific registers 404 (MSRs). Either or both of thedecode logic 402 and the model specific registers may be used to programand/or activate the monitors and the event schema vector and mask. Forexample, MSRs may be used to program the types or number of events thattrigger the monitors. MSRs may also be used to program the event schemavector and mask. Alternatively, one or more new dedicated instruction(s)to be decoded by the decoder 402 may be used for either or both ofprogramming the monitors and the event schema vector and mask. Forexample, a yield instruction (such as an embodiment of the EMONITORinstruction discussed below) may be used to enable disruption ofprocessing a program when a certain set of conditions occurs. Some orall of the conditions may be specified by an operand to the yieldinstruction or otherwise programmed in advance of its execution. Such ayield instruction may be decoded by the decoder 402 to trigger amicrocode routine, to produce a corresponding micro-operation ormicro-instruction, or sequences of micro-operations to directly signalappropriate logic, or activate a co-processor or to otherwise implementthe yield functionality. The concept of yielding may appropriatelydescribe the instruction in some embodiments in which one thread isallowed to continue after executing the yield instruction but may beslowed at some point by execution of another thread or handler. Forexample, a largely single-threaded program may invoke extra servicethreads and share the processor with those extra service threads.

In the embodiment of FIG. 4, a memory 440 includes event handler code450 and a set of main thread instructions 460. In some embodiments, theevent descriptor table may be stored in the same memory or in the samememory hierarchy as the main thread instructions 460 and handler code450. As previously discussed, execution of code for the handler(s) mayspawn a service thread to assist the main program in executingefficiently.

The memory 440 may also store an update module 442 to communicate via acommunications interface 444. The update module 442 may be a hardwaremodule or a software routine executed by the execution resources toobtain new conditions to be programmed into various monitors and/orenablement logic. The update module 442 may also obtain new servicethreads or routines. For example, these may be downloaded by a softwareprogram from the vendor of the software program to provide enhancedperformance. Thus, the network interface 444 may be any network and/orcommunication interface that allows information transfer via acommunication channel. In some cases, the network interface mayinterface to the internet to download new conditions and/or serviceroutines or threads.

In one embodiment, each bit of the event schema vector indicates theoccurrence or non-occurrence of a particular event, with the particularevent possibly being a composite event reflective of (and/or expressedvia Boolean operations in terms of) a variety of conditions or otherevents, such as a scenario. Occurrence of the particular event may setthe bit in the event schema vector. Each bit in the event schema vectormay have a corresponding bit in the event schema mask vector. If themask bit indicates that the particular event is masked, then the controlflow logic 435 may disregard the event, although the bit in the eventschema vector may remain set due to its occurrence. The user may choosewhether to clear the event schema vector when unmasking events. Thus, anevent may be masked for some time and handled later. In someembodiments, the user may choose to specify the trigger as a leveltrigger or an edge trigger, depending upon various issues such as therelationship between event update, sampling and reset (or the hold timeof a trigger event in the ESV)

If the mask bit indicates that an event is unmasked, then the controlflow logic 435 calls an event handler for that particular event in thisembodiment. The control flow logic 435 may vector into the eventdescriptor table 430 based on the bit position in the event schemavector, and accordingly, the event descriptor table may have N entriescorresponding to the N bits in the event schema vector. The eventdescriptor table may contain a handler address indicating an address towhich the control flow logic 435 should re-direct execution, and mayalso include other information as may be useful in a particularembodiment. For example, privilege level, thread, process, and/or otherinformation may be maintained or updated in the event descriptor table.

In another embodiment, the event descriptor table 430 may not benecessary or may be a single entry that indicates an address for asingle event handler to handle all events. In this case, the entry maybe stored in a register or other processor storage location. In oneembodiment, a single handler may be used, and that handler may accessthe event schema vector to determine which event occurred and thereforehow to respond. In another embodiment, the event schema vector maycollectively define an event that causes the control flow logic 435 tocall a handler. In other words, the event schema vector may represent avariety of conditions that together signal one event. For example, theevent schema mask vector may be used to designate which of the eventsindicated by the event schema vector must occur to trigger execution ofthe handler. Each bit may represent a monitor reaching a programmablecondition. When all the non-masked monitors reach their respectivedesignated conditions, then the handler is called. Thus, the entireevent schema vector may be used to designate some complex compositecondition that should trigger the execution of the handler.

In another embodiment, multiple event schema vectors and masks may beused to designate different conditions. The different vectors may vectorto different handlers via the event descriptor table or some othermechanism. In another embodiment, some bits of one or more event schemavectors may be grouped to form events that trigger the calling ofhandlers. A variety of other different permutations will be apparent tothose of skill in the art.

FIG. 5 a illustrates one embodiment of a monitor 500 that isprogrammable and capable of interfacing with a variety of performancemonitors to signal a composite event. For example, in some embodiments,performance monitors may record occurrences of variousmicroarchitectural events or conditions such as: cache misses incurredat a given level of cache hierarchy, branch retirement; branchmisprediction (or retirement of mispredicted branches); trace cachedelivery mode changes or events; branch prediction unit fetch requests;cancellations of memory request; cache line splits (count of completionof a split load, store, etc.); replay events; various types of bustransactions (e.g., locks, burst reads, writebacks, invalidates);allocations in a bus sequencer (or only certain types); numerical assist(an underflow, denormal, etc.); execution/retirement of a particulartype of instruction or micro-operation (uOP); machine clear (or count ofpipeline flushes); resource stalls (register renaming resources,pipeline, etc.); processing of tagged uOPs; instructions or uOPsretired; lines allocated (and/or of a particular state (e.g., M)) incache; a number of cycles instruction fetch is stalled; a number ofcycles instruction length decoder is stalled; a number of cache fetches;a number of lines allocated (or evicted) in cache or the like. In otherembodiments, other events or combinations of events may be monitored.

In order to detect events and scenarios, such as those listed above,various boolean combinations of architectural state (“triggeringconditions”) may be defined within a processor's channels, in oneembodiment. For example, in one embodiment, a triggering condition maybe the execution of an instruction or particular class of instructions(e.g., multimedia or branch instructions). Furthermore, a triggeringcondition may be defined as a function of the occurrence of aninstruction translation look-ahead buffer (ITLB) miss, or as a result ofan instruction executed during a pending interrupt, or being executedfrom a particular address range. These are only a few examples ofinstruction-based triggering conditions. Others may be used in otherembodiments.

Similarly, triggering conditions may be defined as a function of a clocksignal within a processing resource in which events are monitored. Forexample, a triggering condition may be defined to detect the occurrenceof a non-halted core or reference clock. Power events may also be usedas a basis for defining a triggering condition, in some embodiments,including clock frequency and/or voltage changes, or microarchitecturalthrottling events.

Numerous other triggering conditions may be defined for any number ofother processing resource events or conditions, including instructionbranches, cache accesses and transactions (e.g., snoops),fetch/pre-fetch conditions, numerical assist conditions (e.g., overflow,underflow, denormal, etc.), and conditions causing pipeline stalls(e.g., machine clear operations).

In addition to triggering conditions, scenarios can be defined by theinput information they receive to cause the triggering condition. In oneembodiment, scenarios may use scenario-specific input data to tailor thetriggering conditions, they may maintain state history that is used totrigger a yield, and they may maintain state information that can bereported to a service routine after a yield. Examples of inputinformation that may be defined within a given scenario, in at least oneembodiment, include a sample after value (SAV) to specify an initialvalue of a counter to specify a given time interval upon which totrigger, an underflow indicator (e.g., underflow bit) to indicate thepoint at which a counter, such as a downward counter, underflows,latency threshold(s) to indicate the maximum latency of an operationwhose performance is to be monitored, and software instruction and/ordata address ranges specifying a range of instructions or data used byinstructions to cause a triggering condition. Other input data may beused in other embodiments.

In addition to input information, processing state history informationmay be used to trigger a yield in some embodiments. Examples of statehistory information that may be used to trigger a yield, in at least oneembodiment, include a current counter value (e.g., downward countervalue), branch trace history (e.g., calls, returns, conditionalbranches, unconditional branches, indirect branches, forward/backwardbranches, taken/not taken branch, mispredictions, etc.), call stackstate information (e.g., return pointer value, etc.), addresses orsource of event-causing instructions or data, cache coherency state, andmicroarchitectural state, such as latency information and TLB state.Other processing resource state history information may also be used asa trigger condition in other embodiments.

Triggering events may cause a yield to occur, as previously discussed.In one embodiment, the triggering events may cause a yield that behaveslike a fault condition (“fault-like” yield), whereas in otherembodiments, triggering events may cause a yield that behaves like atrap condition (“trap-like” yield). Furthermore, some scenarios fault assoon as the uOP for which the triggering condition is recognized iseligible for execution. Other scenarios may generate a fault upondetection of a write-back or instruction retirement, or upon some timemeasurement related to these events, such as faulting on a loadinstruction having a longest-latency cache miss.

Faulting may be useful in response to conditions where some action is tobe taken prior to the result of the fault-causing event changingarchitectural state in processing resources. For example, faultingenables other functions to be performed during the detection of alongest latency cache (LLC) miss. In this and other situations, faultscan be used to check actions to be taken by software before they areactually performed and to obtain the exact conditions in which aninstruction is executed. Trap-like scenarios, on the other hand, areable to record and report the results of executing an instruction orgroup of instructions.

As previously mentioned, scenarios may defined by programming acombination of event conditions on which to trigger. Specifically,embodiments of the invention may combine any number of events discussedabove or otherwise into one or more scenarios that can be monitored inorder to collect performance data of user-level program running on someprocessing resource. A scenario may cause a yield on the first and everysubsequence instance of a triggering condition or after some number ofinstances (“sampling”).

Scenarios may be viewed as precise or imprecise in one embodiment. Aprecise scenario may be one that is guaranteed to cause a trigger, andsubsequently a yield event, for only an instruction that experienced thetriggering condition. For example, a precise LLC miss scenario may onlycause a yield event after some predefined number of LLC misses, in whichcase only the instruction that resulted after at least the specifiednumber of predefined LLC misses would cause a yield event, and all otherinstructions would not.

In contrast, an imprecise scenario may not be associated with anyparticular instruction. Instead, in an imprecise scenario, only theevent that caused the yield condition is recorded or used. For example,an imprecise scenario may be one in which a change to a cache line stateis recorded due to the occurrence of a snoop operation to that cacheline. In this case, the instruction causing the snoop operation wouldnot be recorded and any event counting may continue. Only the occurrenceof the changed cache line state, and perhaps some information about thecontext of that snoop, such as what instruction was executing when thesnoop occurred, or what the value of the time stamp counter was, isrecorded.

In one embodiment, an imprecise event may be more precisely monitored bycounting the number of events that occur following the imprecise event(“skid”). For example, counting the skid in one embodiment allows a userto correlate an event with a particular instruction by ruling outinstructions associated with events subsequent to the event of interest.

Scenarios may also be characterized, in one embodiment, according towhether they result in a hint to some monitoring program or logic, orwhether the scenario results in an architectural state change within aprocessing resource. For example, a hint scenario may not be required tocount or to cause a yield event on every instance of the triggeringcondition. On the other hand, an architectural scenario may not be ableto cause a yield on every instance of the triggering condition, but yetit may not ignore any instance of a triggering event. For instance,because in some embodiments counting and faults after executing aparticular instruction or instructions may be suppressed, fault-likescenarios may be characterized as hints rather than of architecturalscenarios.

In addition to resulting in a hint or an architectural state change,scenarios may have certain other effects (“side effects”) withinprocessing resources. For example, a scenario may have side effects onnon-channel state, such as writing a buffer upon an EREAD invocation.

Performance monitors are often included in processors to count certainevents. The programmer may read such performance monitors' counts bymanufacturer-defined interfaces such as specific processormacro-instructions like the RDPMC instruction supported by known IntelProcessors. See, e.g., Appendix A of Volume III of the Intel SoftwareDevelopers Guide for the Pentium® 4 Processor. Other internal ormicro-instructions or micro-operations may be used to read performancecounters in some embodiments. Thus, for example, performance monitorsmay be adapted for use with disclosed techniques. In some cases, aprogrammable performance monitor may be modified to provide eventsignaling capabilities. In other embodiments, performance monitors maybe readable by other monitors to establish events.

In the embodiment of FIG. 5 a, the monitor 500 may include a set ofprogrammable entries. Each entry may include an entry number 510, anenable field 511, a performance monitor number (EMON #) 512 to specifyone of a set of performance monitors and a triggering condition 514. Thetriggering condition may be, for example, a certain count that isreached, a count that is reached within a certain period, a differencein count, etc. The monitor 500 may include logic to read or otherwise becoupled to receive counts from the designated performance monitors. Themonitor 500 signals the control flow logic when the various M conditionsoccur. A subset of the M entries may be used by selectively programmingthe enable fields for each entry.

FIG. 5 b illustrates another embodiment of a monitor 520. The monitor520 represents a custom composite event monitor. The monitor 520receives a set of signals via signal lines 528-1 through 528-X fromvarious execution resources or resource portions and combines them viacombinational logic 530. If the proper combination of signals isreceived, the monitor 520 signals the control flow logic via an outputsignal line 532.

FIG. 5 c illustrates another embodiment of a monitor 540. The monitor540 includes a table having M entries. Each entry includes an enablefield 552, a condition field 554, and a trigger field 556. The conditionfield may be programmed to specify what combination of input signals(scenario) is to be monitored. The scenarios may or may not be tied toother event detecting structures such as performance monitors, andtherefore may be more general than those discussed with respect to FIG.5 a. The trigger field 556 may specify the state of those input signalsneeded to signal the control flow logic. Again, each entry may beenabled/disabled via the enable field 552. In some embodiments, thecondition and trigger fields may be combined. Various combinations ofthese and other types of known or otherwise available like, simpler, ormore complex monitors will be apparent to one of skill in the art.

For the purpose illustration of one embodiment, several scenarios willbe discussed that may be used in conjunction with at least oneembodiment of the invention. In particular, several scenarios arepresented along with a summary of parameters that may be programmed intochannel states to monitor the scenarios. Scenarios that may be monitoredin one embodiment include those that monitor when a particularinstruction or instructions is/are retired (“IR-LBR” scenario),scenarios that generate a yield after a load instruction fault resultingfrom a longest latency cache miss (“LF-LLC Miss-LBR” scenario),scenarios that generate a yield after a load instruction is retiredfollowing a longest latency cache miss (“LR-LLC Miss-LBR”), scenariosthat generate a yield after a branch is retired (“BR-LBR” scenario),scenarios that generate a yield after a certain number of un-halted coreclock cycles (“UCC-LBR”), scenarios to record data addresses, accesslatencies, and source information after sampled loads (“LR-LLS-LBR”),and scenarios that generate a yield after a snoop operation (“snoop”scenario).

Below is a table summarizing the above-mentioned scenarios and theircorresponding inputs, triggering conditions, sampling type, statehistory information, yield type, precision characteristic, whether thescenario results in a hint condition versus an architectural statetransition, and any side effects of the scenario:

LF-LLC LR-LLC LFP-LLC IR-LBR Miss LBR Miss-LBR Miss BR-LBR UCC-LBRLR-LLS-LBR Snoop Scenario Instructions Loads with Loads with Loads withBranches Unhalted Sampled Snoops an LLC miss an LLC miss an LLC misscore loads that are clocks pre-data ready Sampling Yes Yes Yes Yes YesYes Yes No Inputs Sample-after SAV SAV SAV SAV SAV SAV Data value (SAV)Address State Branch trace LBRs, LBRs, None LBRs, LBRs, LBRs, data Nonehistory (LBRs), Sample_EIP, Sample_EIP, Sample_EIP, Sample_EIP, source,Sample_EIP, BrInfo BrInfo BrInfo BrInfo coherence BrInfo state, *TLBmisses, latency, Sample_EIP, BrInfo Fault vs. Trap Fault Trap Fault TrapTrap Trap Trap Trap Precise vs. Precise Precise Precise Precise PrecisePrecise Precise Imprecise Imprecise Hint vs. Arch Hint Arch Hint ArchArch Arch Arch arch. Side EREAD EREAD EREAD EREAD EREAD EREAD EREAD Noneeffects buffer buffer buffer buffer buffer buffer buffer

In some embodiments, other scenarios may be programmed and otherparameters may be used to characterize a scenario. However, the tableabove illustrates the characteristics of at least some of the scenariosthat may be used to monitor performance within a processing resourceaccording to one embodiment.

FIG. 6 illustrates further detail for the channels 1300, as illustratedin FIG. 1, for at least one embodiment of a system that can detect andrespond to architecturally-defined processing conditions of executionresources. The channels are a set of architectural states. For at leastone embodiment, each channel includes a scenario identifier andoccurrence-response information.

For at least one embodiment, the state information for a channel may bemaintained in programmable channel register 1320. The channel register1320 may be part of an architecturally-visible mechanism to map anarchitectural trigger condition to a handler address. Another part ofthe architecturally-visible mechanism may be an instruction. That is, atleast one embodiment of a system 1200 that includes the channelregisters 1320 may support an architectural instruction that providesfor programming (by, for example, an instruction in a user-levelprogram) the contents of the channel registers 1320. Such an instructionmay be referred to herein as an EMONITOR instruction.

FIG. 6 illustrates that the state information for the channels 1300 maybe maintained in one or more channel registers 1320. For at least oneembodiment, only one set of channel registers 1320 is utilized. Forother embodiments, additional channel registers may be utilized. Theoptional nature of additional channels 1300 is denoted in FIG. 6 withbroken lines.

For example, a first set of channel registers 1320 may be utilized tomap yield events for one level of privilege (such as ring 0 operations)and a second set of channel registers 1320 may be utilized to map yieldevents for another level of privilege (such as ring 3 operations). Inthis manner, transition to particular service threads may be identifiedfor particular service levels.

For at least one embodiment, each channel register 1320 may be utilizedto specify an architecturally-defined event or set of conditions. Theevent or set of conditions may be referred to as a scenario. The eventor set of conditions may be architectural, microarchitectural, or acombination of both. The channel registers 1320 may be further utilizedto map a target yield address to the specified scenario.

The scenario may be identified by placing a value in the “scenario ID”field 1328 of the register 1320. For at least one embodiment, eachregister 1320 includes a scenario ID field 1328. The scenario id field1328 may be modified (via execution of an EMONITOR instruction, forinstance) to hold a value that represents an architecturally definedscenario.

A scenario may be used on all channels simultaneously. In other words,the same scenario can be programmed on more than one channel at a time.Each time a scenario is configured to a channel, it is instantiatedonce. All instances of the scenario execute independent of each other.For example, the “instruction retired counter underflow” (IR-LBR) (seescenario 3 in table below) scenario can be configured on both channel 0and channel 1 at the same time. The counter of the IR-LBR instanceconfigured on channel 0 may be set, for instance, to 500 k by the mainthread program. Similarly, the counter of the IR-LBR instance configuredon channel 1 may be set by the main program to a different number, suchas 100 k. For such example, channel 1 may generate a yield event requestafter 100 k instruction are retired while Channel 0 may generate a yieldevent request after 500 k instructions are retired.

A scenario is a Boolean expression of selected architectural and/ormicroarchitectural conditions that can occur during execution. Examplesinclude the retirement of an instruction, or a longest-latency cachemiss. Satisfaction of the scenario conditions may cause a counter toincrement or decrement and/or may lead to setting of a value in the YERfield 1330 (discussed below). A scenario may include a single processorevent (see, e.g., Scenario Identifiers 1 and 3 in the table below).Alternatively, a scenario may be a composite of two or more raw events(see, e.g., sample Scenario Identifiers 0 and 2 in the table, below).For at least one embodiment, the scenario may be a Boolean expression oftwo or more raw events. An example of some example scenarios that may bearchitecturally defined for a system, such as, e.g., the sample systemillustrated in FIG. 1, are set forth in the table below. Such examplesshould in no way be taken to be limiting and are provided by way ofexample only. Alternative embodiment could, of course, implement in thechannel register a bit mask that allows the user to define auser-defined set of raw events as a triggering scenario for a channel.

Scenario Identifier Boolean Definition 0 Last level cache miss ANDpipeline stall 1 Address match for interconnect (bus or point- to-point)2 Last level cache miss AND cache miss counter overflow 3 Instructionretired counter overflow 4 Retired branch counter overflow 5 Fault-typeload miss in last level cache AND early data ready 6 Unhalted coreclocks 7 LD instruction retired with linear address, latency, datasource

The above table illustrates that certain of the scenarios may be definedas composite Boolean expressions, such as scenarios 0, 2, 6 and 7. Forscenario 0 illustrated in the above table, the scenario includes a lastlevel cache miss and a pipeline stall. For such scenario, it is desiredthat disruption of a main thread be triggered when a pipeline stall isexperienced as a result of a cache miss. Similarly, scenario 2illustrated in the above table may be defined as a last level cache missand overflow of a cache miss counter. For such scenario, disruption ofprocessing is triggered only after a predetermined number of cachemisses has been experienced. Scenario 6 illustrated in the above tablemay be satisfied when a clock tick has occurred at core frequency andthe processor was not halted when the clock tick occurred. Scenario 7illustrated in the above table may be satisfied when an architecturalload instruction retires and the latency of the load instruction met orexceeded a specified threshold.

The above table also illustrates scenarios that are architecturallydefined as a single raw event. For example, scenario 1 illustrated inthe above table is defined as a single raw event. That is, scenario 1 isdefined as a match for interconnect address. For such scenario,disruption of processing may be triggered when the address of theprocessor (see, e.g., 100 of FIG. 1) matches the address for acommunication packet this is received from another processing element ofthe system. The address may be received over, for example, a multi-dropbus or a point-to-point interconnect (not shown).

The above table illustrates that scenario 4 may also be defined as asingle raw event. Specifically, scenario 4 may be defined as overflow ofa counter that tracks the number of retired instructions. For suchscenario, disruption of processing is triggered when the retirementcounter indicates that the desired number of instructions has beenretired. Such scenario may be useful for performance monitoringprocessing. For scenario 4, the number of instructions whose retirementsatisfies the scenario condition may be programmable.

Scenario 5 illustrated in the above table may be defined as a single rawevent—a last level cache miss for an architectural load instruction. Forsuch scenario, the machine doesn't wait for the data to return beforethe yield event is taken. This creates an opportunity to get otheruseful work accomplished in the shadow of the last-level-cache (“LLC”)miss. The purpose of Scenario 5 is thus to create an opportunity to douseful work in the shadow of an LLC miss.

Accordingly, the channel register 1320 may include an additionaloptional field (not shown) whose value identifies scenario-specificinformation. Such scenario-specific information may include, forexample, a count value after which to trigger (also called sample aftervalue). Regarding a sample after value, the conditions for taking ayield event may include counting and the consequent setting of acounter, such as an underflow or overflow counter, which can be seteither by the down-counting from a user-specified sample-after value, orby pre-setting the Underflow bit by the user.

For instance, some scenarios, such as profile-guided optimization (PGO)scenarios, may use a counter to determine when to set the yield eventrequest bit.

Other examples of scenario-specific information that may be included inan optional field of the channel register 1320 include a thresholdvalue, and/or a linear address. For example, snoop-related scenarios mayhold a linear address as part of their scenario-specific state. Ofcourse, other additional state information not specifically enumeratedherein may also be specified by a EMONITOR instruction for the optionalscenario-specific information field for a particular channel register1320.

The scenarios architecturally defined for any particular embodiment maybe prioritized. Accordingly, if more than one scenario occurs atrelatively the same time, only one is picked for immediate servicing.The other(s) scenarios occurring at the same time may be logged forlater servicing.

FIG. 6 illustrates that each register 1320 also includes a “yield targetaddress” field 1324. Again, a value for the yield target address field1324 may be programmed into the channel register 1320 via execution ofthe EMONITOR instruction. For at least one embodiment, the value placedinto the yield target address field by the EMONITOR instruction isreferred to herein as a “thread yield EIP.” For at least one embodiment,the thread yield EIP represents an offset into the current code segment.

The current code segment, for purposes of this discussion, may be thecode segment indicated by a register such as a code segment (“CS”)register. The offset represented by the yield EIP may represent anoffset from the beginning of the code segment to the first instructionof the selected service thread or event handler that is to be executedwhen the conditions of the indicated scenario are met. Of course, one ofskill in the art will recognize that the thread yield EIP value placedinto the yield target address field 1324 of a channel register 1320 may,instead, be any other value that indicates a starting address, includingan address value or a pointer.

The yield target address field 1324 is optional for at least oneembodiment of the system 1200 illustrated in FIG. 6. For one embodiment,for example, the thread yield EIP is maintained in a memory structure,such as a user stack.

FIG. 6 illustrates that each channel register 1320 may also includeother, optional, fields. These optional fields may include a channelidentifier field 1322, a action field 1326, a yield event request(“YER”) field 1330, and a valid field 1332. One of skill in the art willrecognize that these optional fields 1322, 1326, 1330 and 1332 areprovided for illustrative purposes only and should not be taken to belimiting. For other embodiments, fewer fields, or different fields, maybe defined in the channel registers 1320.

For the embodiment illustrated in FIG. 6, the optional channelidentifier field 1322 may be utilized to identify the channel register1320. For at least one embodiment, the values for the channel identifierfield 1322 numbers may not be unique among all channel registers. Forexample, for an embodiment that maintains one set of channel registersfor one privilege level, and another set of channel registers foranother privilege level, the channel identifiers may be repeated amongthe sets. For example, one set of channel registers 0-3 may be allocatedfor ring 3 operations while another set of channel registers 0-3 may beallocated for ring 0 operations.

The channels may thus be associated with ring levels. Each channel isassigned to a ring level and can only be used in this ring level.Although only four channels are illustrated in FIG. 6 for each ringlevel, such illustration should not be taken to be limiting. Any numberof channels may be supported for each ring level, and each ring levelneed not necessarily be allocated the same number of channels as otherring levels. For at least one embodiment, each ring level can have up to256 channels which are indexed from 0 to 255. The channel identifier,also called a channel index, for such embodiment may be encoded in an8-bit space; the channel identifier field 1322 may thus be an 8-bitfield.

The optional action field 1326 may be utilized as follows. The value ofthe action field 1326 indicates the type of action that should be takenwhen the scenario identified in the channel register's scenarioidentifier field 1328 occurs. For at least one embodiment, the actionfield 1326 is a four-bit field that can therefore encode up to 16 actiontypes. For at least one embodiment, the valid action type values for theaction field 1326 may include a yield action value and a status bitupdate value. If the action field 1326 includes the yield action value,then the following action will be taken: when the YER field for thechannel is set (see discussion of YER field 1330, below), a yield eventwill occur such that control flow will be transferred at the instructionindicated in the yield target address field 1324.

If the action field 1326 includes the status bit update value, then thechannel is in “silent” mode, and no yields will be taken by the channel.That is, when the specified scenario for the channel occurs, a yieldevent will not occur. Instead, certain specified status bits areupdated. For example, the value of the YER field 1330 may be updated.

The value in the optional YER field 1330 may be utilized to indicatewhether the triggering condition defined by the scenario has occurred,along with any other conditions required by the scenario, such as acounter underflow and precision constraints. For at least oneembodiment, the YER field 1330 may be a one-bit field.

The value of the YER field 1330 may be set by the processor when atriggering condition, and any other required conditions, for a scenariohave been met. However, the yield event request bit can be defined to beset only if the privilege level at which the triggering condition isdetected matches the channel's privilege level, or if the privilegelevel at which the triggering condition is detected is greater than orequal to the channel's privilege level.

For at least one embodiment, the YER value may be cleared by theprocessor when that channel's yield event successfully transfers controlto the designated yield target address. If the YER bit is set but theyield event cannot be serviced, and an additional triggering conditionoccurs, a counter may record the additional triggering condition whilethe YER bit remains set. For at least one embodiment, the clearing ofthe YER value and/or the recordation of additional triggering conditionsmay be performed by an event handler mechanism.

The YER value 1330 may useful for an embodiment that allows triggeringscenarios to be serviced as either a fault-like yield event or as atrap-like yield event. That is, some scenarios may fault as soon as theinstruction or micro-operation for which the triggering condition isrecognized is eligible for retirement, such as faulting on a load thathas a longest-latency cache miss. Faulting may enable work to beaccomplished in the shadow of an LLC miss. The value in the YER field1330 thus may be set to indicate a fault-like yield. (For at least oneembodiment, the value of the YER field 1330 is set by hardware.) Thistype of value in the YER field 1330 may be set, for example, when theyield event is intended to trigger a service thread whose concurrentexecution with a main thread is intended to clear up a condition thatwould otherwise cause the main thread to stall or perform poorly. Theservice thread may thus perform processing in the “shadow” of the eventdefined by the scenario that triggered the yield event. This allows theservice thread to perform its processing as if the faulting instructionhas not occurred at all, in parallel with the main thread processing.

A fault-like yield event thus appears to software that the faultinginstruction has not been executed. When the yield event is delivered,the processor states look to the software like the faulting instructionhas not yet been executed. For example, consider a load instruction (LD)that is to update the value of a register, R1. Consider, for purposes ofexample, that a channel has been programmed to perform a fault-likeyield event (based on value of the scenario id) when the loadinstruction yield event occurs and that an architectural scenario hasbeen identified for a faulting load instruction, and that the scenarioidentifier field 1328 value specifies this scenario. At the time thatsoftware is handling the yield event, the event handler does not see anyupdate to R1 based on operation of the LD instruction.

In contrast, trap-like scenarios are able to record and report theresults of executing the instruction. Such scenarios are useful when itis desired that the trapping instruction complete execution before theyield event processing is performed. By setting the value of the YERfield 1330 to an appropriate value, a trap-like yield event may beindicated. Such type of event may be useful, for example, when the eventhandler is to perform performance monitoring. In such case, it may bedesirable for the trapping instruction to complete execution beforeprocessing performance monitoring information based on execution of theinstruction. A trap-like yield event thus appears to a programmer as ifthe trapping instruction has already been retired.

Accordingly, a yield event may be programmed in a channel register 1320as either a fault-like event or trap-like event, depending on whichscenario id has been selected. For at least one embodiment, trap-likeyield events are only signaled on an interrupt boundary. In contrast,fault-like yield events may be signaled in the middle of an instruction,for at least one embodiment.

As is explained above, even if the values of a channel register 1320have been programmed to indicate that a yield event should be processedupon occurrence of a scenario, such yield event will not be taken if theblocking indicator 1380 for the ring level associated with the channelregister 1320 indicates that yield events should be blocked.

For at least one embodiment, multiple channels can be usedsimultaneously, but only one channel's yield event can be serviced at atime. That is, if multiple yield events occur simultaneously, theprocessor selections the highest priority event for servicing. Suchselection may be performed, by at least one embodiment, by an eventhandler mechanism.

The process of invoking the service routine when servicing a yield eventmay include setting the yield blocking indicator 1380 and clearing thevalue of the yield event request field 1330 for the highest-prioritychannel, whose service routine is invoked by a yield event. Again, theclearing of the YER field 1330 may be performed by an event handlermechanism. The clearing of the blocking indicator 1380 may be performedby execution of an ERET instruction at the end of the service routine.

Regarding priority, a priority may be established among channels, sincethe YER bit may be set for the same uop or instruction for multiplefault-like scenarios or trap-like scenarios, respectively, at the sameprivilege level. (Yield events are only taken for channels associatedwith the current privilege level). For at least one embodiment, adifferent priority scheme may be used for fault-like than for trap-likescenarios.

For trap-like scenarios, whenever there is an opportunity to take atrap-like yield, the highest-priority channel for which the YER bit isset and for which the channel action field is set is serviced first. Forat least one embodiment, the highest-priority channel is thelowest-indexed channel with a pending trap-like yield request. As thatyield is taken, the YER bit is cleared for that channel. Other channels'YER bits remain set, and they are serviced at the next window for takingtraps, if their conditions for taking a yield event still hold (i.e.,when the yield block bit is clear, the YER bit is still set, etc.). Inthis manner, each channel's pending trap-like yield is serviced in turn,with a fixed, predictable ordering.

For fault-like scenarios, prioritization may be handled as follows. Whenthere is an opportunity to take a fault-like yield, exactly onefault-like yield among all programmed fault-like scenarios is selected,and all other fault-like yield requests generated by other fault-likescenarios are dropped, i.e., their channel YER bits are cleared.Fault-like scenarios that can be triggered by the same dynamic instanceof an instruction are prioritized at the time they are defined. Forscenarios so defined, the highest priority scenario is selected to beserviced and all other lower-priority scenarios will have their channelYER bit cleared and thus they are not serviced for this eventoccurrence. They will be serviced the next time the event occurs if thehigher-priority scenarios are not ready to fire. For scenarios that donot have pre-defined priority, they are serviced in the order which theyare encountered during execution. The fault-like scenarios does not haveYER bit semantics.

On the topic of prioritization, it should be noted that yield events maybe prioritized among other processor events (such as traps andexceptions). For at least one embodiment, this may be accomplished via apriority table. An example of a priority table is set forth below in thetable below. One of skill in the art will understand that otherembodiments may include different processor events. The table below isset forth below merely for purposes of example.

FIG. 6 illustrates that a channel register 1320 may also include a validfield 1322. The value of the valid field 1322 indicates whether theregister 1320 contains valid data. For at least one embodiment, thevalid field 1322 is a one-bit field. For such embodiment, the channel isvalid when the value in this field is set. The channel is invalid whenthe value of the one-bit field 1322 is cleared. When the channel validbit is clear, all of the other channel state is invalid, and will beread as 0. (See discussion, below, of EREAD instruction for reading thecontents of a channel register).

Similarly, at least one embodiment of the system 1200 may also supportan architectural instruction that provides for reading the contents of achannel register 1320. Such an instruction may be referred to herein asan EREAD instruction.

FIG. 6 illustrates that a storage medium 150 may include an operatingsystem 1230. For at least one embodiment, the operating system 1230 mayprovide context management functionality, such as context save andrestore services, for channel state when a context switch occurs inresponse to the monitor events programmed into the channel register(s)1320.

In addition to an EMONITOR instruction that may program the variousfields (except the YER BIT) of the channel register 1220 as discussedabove, the system illustrated in FIG. 6 may also provide anarchitectural instruction that provides for an instruction in a userprogram to query the contents of a channel register 1202. At least oneembodiment of such an instruction is referred to herein as an EREADinstruction. In addition, the system illustrated in FIG. 6 may alsoprovide an architectural instruction that returns control to a mainthread after a yield event has been delivered. Such instruction isreferred to herein as an ERET instruction.

Certain details for the EMONITOR, EREAD, and ERET instructions are setforth generally in the table below. In addition, further detail for eachof the instruction is set forth in the discussion following the tablebelow. One of skill in the art will recognize the specific opcodes,register names and field bit lengths and values are provided forillustrative purposes only and should not be taken to be limiting. Otheropcodes, field lengths, field values, and register names may be utilizedwithout departing from the scope of the appended claims.

Instruction Description EMONITOR Programs a channel with data in ECX,EBX, EAX, EDX EREAD Reads a specified channel and returns the data inECX, EBX, EAX, EDX ERET Yield interrupt return.

EMONITOR—Set up channels. EMONITOR takes input from registers (referredto as ECX, EBX, EAX, and EDX below) to program a channel.

-   -   ECX        -   ECX[7:0] contains scenario ID, 0 to 255;        -   ECX[12:9] contains channel action encoding            -   0 means no action;            -   1 means call yield event;            -   2 to 15 are reserved.        -   ECX[13] contains yield event request.        -   ECX[15:14] contains ring level.        -   ECX[23:16] contains channel ID, 0 to 255.        -   ECX[24] contains channel valid bit        -   Other bits are reserved to zero. Non-zero values in any            reserved bit may cause the instruction to fault.

The value in ECX[23:14] specifies the channel to be programmed by theEMONITOR instruction. It should be noted that the EMONITOR instructionmay be implemented to allow higher priority code to access channels thathave been allocated for lower priority code. Accordingly, ring 0 codemay be permitted to access ring 3 channels. Therefore the channelselection needs to take ring level into account (e.g., ECX[15:14).However, ring 3 code cannot access the channels that belong to ring 0.If ring 3 code executes this instruction with ring level specificationin ECX[15:14]=0, the instruction may cause a general purpose fault.

If ECX[13], the yield event request bit, is set to 1 for a precisescenario, a general purpose fault will result, since it doesn't makesense for an instruction, EMONITOR, to set the YER for an instructionwhich otherwise did not meet the triggering conditions.

EBX contains the YIELD_TARGET_EIP. The EMONITOR instruction thus setsthe value in the yield target address field 1324 of the specifiedchannel with the address specified in EBX.

EAX communicates additional scenario-specific information to theinstruction. The scenario definition specifies what additionalinformation is required to be provided to set up a channel properly tomonitor the scenario. EAX can contain the additional data to be loadedor can be a pointer to a memory buffer from which additional data isloaded. The use of EAX is scenario specific. EAX is ignored if thespecified scenario does not have any additional states defined.

EDX communicates additional hints to the instruction and will not changethe architectural behavior of the instruction. EDX is reserved as 0 ifthe specified scenario does not have any hints defined.

EREAD—Read channel. The EREAD instruction does the reverse operation ofthe EMONITOR instruction. It reads the channel specified in ECX [23:14]and returns the data into ECX, EBX, EAX, and EDX. As with the EMONITORinstruction, EAX can contain a pointer to a memory region into whichEREAD stores the additional channel scenario specific data. Somescenarios do not have any additional data. Therefore, EAX is not usedfor those scenarios.

EREAD may utilize the following fields of ECX as input parameters:

-   -   ECX[7:0] contains the scenario ID, 0 to 255.        -   ignored if ECX[8]=0    -   ECX[8] contains the Match scenario ID bit.        -   1 requires that the scenario-specific side effects for            non-channel state to occur if the value in the channel            scenario ID field matches ECX[7:0].        -   0 requires that such scenario-specific side effects do not            occur, regardless of the channel's scenario ID field, i.e.            ECX[7:0] is ignored    -   ECX[15:14] contains the ring level.    -   ECX[23:16] contains the channel ID, 0 to 255.    -   Other bits are reserved to zero. Non-zero values in these bits        causes the instruction to GP fault.

For EREAD, the use of EAX to hold a parameter for the instruction isscenario specific. EAX may be used to specify a valid memory pointer toa memory region into which the scenario specific data can be stored uponEREAD. For scenarios dumping out no additional data, EAX may be ignoredby the EREAD instruction. For at least one embodiment of the EREADinstruction, EBX and EDX are not utilized.

The layout of states returned by EREAD is as follows (which correspondsto the input format defined for EMONITOR, discussed above):

-   -   ECX        -   ECX[7:0]←scenario ID in channel, 0 to 255.        -   ECX[8]←0.        -   ECX[12:9]←channel action.        -   ECX[13]←yield event request.        -   ECX[15:14]←ring level (unchanged from input)        -   ECX[23:16]←channel ID, 0 to 255, (unchanged from input)        -   ECX[24]←channel valid bit.        -   Other bits of ECX contain 0 for at least one embodiment.

EBX may contain the yield target address. EDX may contain additionalhints associated with the channel. EDX is read as 0 if the specifiedscenario does not have any hints defined.

[EAX] contains additional scenario-specific data, if there is any. Forexample, the current EIP value and LBR are dumped into the memory bufferpointed to by [EAX] for the “retired instruction counter underflow”scenario.

EAX contains the additional scenario-specific data that EMONITORspecifies in EAX to program the scenario logic. For example, the currentcounter value is returned in EAX for scenarios that support a counter.EAX is unchanged if the specified scenario does not have any additionalstates to be returned in EAX.

If the channel is invalid, as indicated by the value in the valid field1332, all registers (EAX, EBX, ECX, EDX) are read as 0, except forECX[23:14].

ERET—Yield interrupt return. For at least one embodiment, user-levelevent handling triggered by satisfaction of trigger conditions in achannel is performed as an atomic block with respect to receivinganother yield event. When a yield event occurs, a yield event handlermechanism may set a value in a yield block indicator (see, e.g., 1380,FIG. 1) to prohibit further yield events and therefore enforceatomicity. The ERET instruction unblocks the yield event (by clearingthe yield block indicator) to re-enable yield events. The ERETinstruction is used by the channel's service routine to return to thecontinuation point. The ERET instruction thus transfers the programcontrol back to a return address.

Accordingly, the ERET instruction obtains the return address as part ofits operation. For at least one embodiment, the ERET instruction popsthe top of stack into the EIP register. Such embodiment assumes that,when a yield event is delivered, a return address is pushed onto thestack. Alternatively, the ERET instruction may obtain the return addressfrom a register. Again, for such embodiment it is assumed that thereturn address (e.g., the address of the next instruction following theinterrupted point) was placed into the register before the yield eventwas delivered. In either case, for at least one embodiment the returnaddress is saved (either in a register or on the stack) by a yield eventmechanism.

Scenarios may be defined and used in some embodiments to improve oroptimize user-level software for a particular processing resource.Accordingly, at least one embodiment may be used in conjunction withvarious techniques, or “user models”, to improve user-level software. Inparticular, one or more scenarios may be used to identify frequentlyexecuted instructions, or “hot code”, for example. Branch profiling maybe performed, in one embodiment, to improve code layout and improvebranch functions. In one embodiment, cache misses may be profiled tofind good candidate instructions/data to be prefetched. Furthermore,cache miss profiling may be combined with coherency profiling to helpavoid cache misses, in one embodiment. The following table summarizesvarious user models, according to one embodiment, including scenariosand corresponding user action, to improve user-level software:

User Model Scenario(s) Use “Hot IR-LBR, Use IR-LBR to collectinstruction Code” UCC-LBR samples based on instruction Profilingfrequency. Use UCC-LBR to collect instruction samples based on executionduration. Focus static (next compile) or dynamic (same execution)optimization on the indicated hot spots Branch BR-LBR Use BR-LBR tocollect information Profiling on branch directions and mispredic- tions,and on path histories. Arrange code so that fall-through targets aremost likely, perform path-based optimizations on longer sequences ofcode, and convert branches with poor predictability to cmovs wherepossible. Cache Miss LF-LLC Use LF-LLC Miss-LBR to record the ProfilingMiss-LBR load instruction address, and use the architectural registersand instruction opcode to compute the data address accessed. Identifythe spatial relationship between dynamic clusters of objects, and insertsoftware prefetches to eliminate cache misses. Cache Miss LF-LLC UseLF-LLC Miss-LBR to record the and Miss-LBR, load instruction address,and use Coherency LR-LLLS- the architectural registers and Profiling LBRinstruction opcode to compute the data address accessed. Use LR-LLLS-LBR to record the source of data and its coherence state. Performclustering and data layout optimi- zations, including affinitization, toreduce memory traffic and laten- cy, and to eliminate false sharing LoadLR-LLS-LBR Use LR-LLS-LBR to record data Latency addresses, accesslatencies, and Profiling source information for sampled loads. Identifythose loads which may be good candidates for prefetching. Helper LFP-LLCUse LFP-LLC Miss simply to get Threads control when a longest-latencycache miss has occurred. Make a switch to alternate work within the sameapplication that can make forward progress in the shadow of the cachemiss. Single IR-LBR Use IR-LBR in debugging and other steppingapplications to execute a single instruction at a time.

Other user models may be realized in various embodiments of theinvention. Furthermore, other implementations, including otherscenarios, may be used to realize one or more of the above-illustrateduser models.

FIG. 7 illustrates an architecture to monitor events occurring withinprocessing resources and to use the monitored events to improve oroptimize user-level software programs running within the architecture,according one embodiment. Particularly, FIG. 7 illustrates a managedrun-time environment 701, in which user-level software programs, such asapplications, may be developed. In one embodiment, a software program isperformed by a CPU 720, which may include a plurality of processingresources, such as a multi-core processor and/or multiple processors.Channels 715 may be programmed via the profiling application programminginterface (API) 710 to monitor events and scenarios useful in detectingcertain performance characteristics of the CPU, such as code hotspots.Performance characteristics, such as code hotspots may be detected bylogic or software 707 by interpreting the results of the events andscenarios programmed into the channels. Furthermore, yield actionsprogrammed into the channels may also be interpreted and the properhandlers invoked in response thereto by the detection code/logic 707.

The performance information interpreted and detected by the detectionlogic/code 707 may be used to generate a profile of the monitoredcharacteristic(s) by profile generation code or logic 703, which maythen be translated into specific actions or methods by profile methodgeneration code or logic 705 to improve or optimize a user's code, suchas an application, within the managed-run time environment. Moreover,the improvements to a user's code may be done, in one embodiment, inreal-time and on a per-thread basis with little or no detection overheadimposed by the performance monitoring architecture of FIG. 7. In otherembodiments, other stages or functional units may be used to generatethe information required to detect performance information within theCPU and to optimize a user's code in response thereto.

In order to facilitate various event monitoring operations, a processorused in conjunction with one or more embodiments may include varioushardware “hooks”, such as logic, storage areas, and the like. Forexample, in one embodiment, the processing hardware illustrated in FIG.7 may include registers, such as user-level branch registers (ULBRs), tohelp store a trace of branches taken in a user-level program. A branchtrace, according to one embodiment, is a sequence of recent branchesthat have been retired within the processor being monitored. Branchtrace information may be useful for software improvements, such aspath-based optimizations. Furthermore, studies suggest thatmicroarchitectural events may correlate with call and branch history,which may be exploited through prefetching instructions corresponding tocertain architectural paths. Branch traces may also be useful inobtaining multiple branch event samples at once, thereby reducing eventmonitoring overhead. Moreover, branch traces may provide contextualinformation that is helpful in software performance analysis anddebugging.

In addition to ULBRs, which may be used to record branch from-toinformation due to user code execution, branch traces may be recordedthrough system-level branch registers (SLBRs), which may be used torecord branches caused by the system, including interrupts, yieldevents, instruction pointer returns (“ERET”). Moreover, SLBRs may recordbranch trace information also recorded by the ULBRs. In someembodiments, ULBRs or SLBRs may be located and maintained within aprocessor being monitored by one embodiment of the invention, whereas inother embodiments, they may be within and maintained by a separateprocessing logic. Available resources corresponding to the ULBRs andSLBRs may be indicated to a user through an identification process, inone embodiment, including a CPU identification mechanism (e.g.,“CPUID”).

In one embodiment, ULBRs may store 64 bits, but may store more or lessin other embodiments. Furthermore, ULBRs may only be updated undercircumstances, in some embodiments. For example, in one embodiment, theULBRs are not updated if either the beginning or end of the execution ofa branch is not of a certain privilege level (e.g., “ring 3” accordingto an x86 architecture), or if there is not a valid channel whichidentifies a scenario that may make use of a ULBR, or if a yield blockbit is set at either the beginning or end of the execution of a branch,or if processor being monitored is in a mode for which channels aredisabled at either the beginning or end of the execution of a branch.Furthermore, the ULBRs may not be updated in other situations, includingif the global freeze bit is set at either the beginning or end of theexecution of a branch, or if a branch is not taken, or if a controltransfer is a yield event.

ULBRs may also be indicated to be valid or invalid (via a “valid” bit,for example). In particular, ULBRs may be invalidated for variousreasons, including the occurrence of a context switch or virtual machinetransition, or if no valid channel is programmed with a scenario thatreports the ULBRs.

In some embodiments, ULBRs may not be updated for ERET instructions thatare executed while the yield block bit is set. This allows ERETs to beineligible for causing triggering when triggering is otherwisesuppressed during a yield event service routine, but allowed iftriggering conditions are being monitored during such service routines.

Embodiments of the invention enable precise capturing of performanceevent information by using coherence and source information associatedwith data captured in response to an event or scenario. In oneembodiment, this coherence and source information may be used toindicate where in memory the data originated, in order to enable a moreprecise determination of the instruction or instructions that caused theevent.

For example, data source and coherence information may collected both ina processor core being monitored core as well as in an associated memorycontroller or chipset. Particularly, interconnect messages from thesesources may be interpreted to infer the source and coherency informationassociated with the data. In one embodiment, data source and coherenceinformation may be stored in memory load buffers within the processorcore's memory execution unit (MEU). From the MEU, the source andcoherence information may be sent along with the data write-backinformation to the processor's retirement logic, enabling the retirementlogic to precisely associate that information with a memory instructionthat corresponds to the event that generated the data. Channel logic,properly programmed, may recognize and respond to these memory events,thereby allowing the collection of precise samples for memoryoperations.

Numerous other mechanisms may be used to generate information that maybe used to monitor performance of processing hardware in variousembodiments. For example, in one embodiment, execution latency ofinstructions may provide information as to the type of instruction beingexecuted or the type of memory access being performed, which may assistin further improving program performance. Qualifying instructions bylatency, for example, may enable one to group instructions or memoryaccesses according to their latency in order to create a profile, suchas in a histogram, of instruction latency.

During development, a design may go through various stages, fromcreation to simulation to fabrication. Data representing a design mayrepresent the design in a number of manners. First, as is useful insimulations, the hardware may be represented using a hardwaredescription language or another functional description languageAdditionally, a circuit level model with logic and/or transistor gatesmay be produced at some stages of the design process. Furthermore, mostdesigns, at some stage, reach a level of data representing the physicalplacement of various devices in the hardware model. In the case whereconventional semiconductor fabrication techniques are used, the datarepresenting the hardware model may be the data specifying the presenceor absence of various features on different mask layers for masks usedto produce the integrated circuit. In any representation of the design,the data may be stored in any form of a machine readable medium. Anoptical or electrical wave modulated or otherwise generated to transmitsuch information, a memory, or a magnetic or optical storage such as adisc may be the machine readable medium. Any of these mediums may“carry” or “indicate” the design or software information. When anelectrical carrier wave indicating or carrying the code or design istransmitted, to the extent that copying, buffering, or re-transmissionof the electrical signal is performed, a new copy is made. Thus, acommunication provider or a network provider may make copies of anarticle (a carrier wave) embodying techniques of the present invention.

Thus, techniques for a system to profile and optimize user software in amanaged run-time environment are disclosed. While certain exemplaryembodiments have been described and shown in the accompanying drawings,it is to be understood that such embodiments are merely illustrative ofand not restrictive on the broad invention, and that this invention notbe limited to the specific constructions and arrangements shown anddescribed, since various other modifications may occur to thoseordinarily skilled in the art upon studying this disclosure. In an areaof technology such as this, where growth is fast and furtheradvancements are not easily foreseen, the disclosed embodiments may bereadily modifiable in arrangement and detail as facilitated by enablingtechnological advancements without departing from the principles of thepresent disclosure or the scope of the accompanying claims.

1. A system comprising: a processor including a plurality of channels tostore a plurality of state information corresponding to a plurality ofinstruction threads, each channel having a different priority andspecifying a trigger-action mapping for a scenario associated with thechannel responsive to which a yield event is to occur to transferexecution to a yield event service routine associated with the channel,and a block indicator to provide an override of the yield event, whereinif multiple yield events occur simultaneously, a highest prioritychannel is selected for servicing; a scenario detection unit to detectperformance characteristics via interpretation of the occurrence ofevents within the processor, a combination of events being determined bythe plurality of state information; a profiling unit to generate aprofile of the combination of events according to a user model, and aprofile method generator to translate the profile into a method; amanaged run-time environment (MRTE) to modify user code of at least oneof the plurality of instruction threads within the MRTE to improve theuser code during run-time of the at least one instruction threadaccording to the combination of events detected by the scenariodetection unit, the modification including optimization of the user codeof the at least one instruction thread via the method.
 2. The system ofclaim 1 wherein the plurality of channels include control information tocombine the events.
 3. The system of claim 2 wherein the plurality ofstate information comprises yield information to control the manner inwhich the events are to be detected by the scenario detection unit. 4.The system of claim 3 wherein the manner in which the events are to bedetected is chosen from a group consisting of: a fault-like yield andtrap-like yield.
 5. The system of claim 1 wherein the user model is touse a profile chosen from a group consisting of: hot code profiling,cache miss profiling, cache miss and coherency profiling, load latencyprofiling, and helper threads.
 6. The system of claim 1 wherein theprofiling unit is to interface with the plurality of channels via anapplication program interface (API).
 7. The system of claim 1 whereinthe plurality of threads are to be modified on a per-thread basis duringrun-time of the plurality of threads.
 8. An apparatus comprising: aprocessing resource; a plurality of state registers to store a pluralityof event triggering conditions corresponding to a plurality of threadsof instructions to be performed by the processing resource, each of theplurality of state registers having a different priority and specifyinga trigger-action mapping for a scenario associated with the stateregister responsive to which a yield event is to occur to transferexecution to a yield event service routine associated with the stateregister, and a block indicator to provide an override of the yieldevent, wherein if multiple yield events occur simultaneously, a highestpriority state register is selected for servicing; a profiling unit togenerate a profile of the plurality of event triggering conditionsaccording to a user model; a profile method generator to translate theprofile into a method, user code of at least one of the plurality ofthreads to be modified in a managed run-time environment (MRTE) duringrun-time of the at least one thread in response to the occurrence of atleast one of the plurality of event triggering conditions according tothe user model to change the performance of the at least one thread bythe processing resource by optimization of the at least one thread viathe method.
 9. The apparatus of claim 8, wherein the plurality of stateregisters is to further store yield event information to determinewhether the occurrence of the at least one triggering event is to resultin a fault-like yield or a trap-like yield.
 10. The apparatus of claim 9further comprising logic to combine the plurality of triggering eventsinto at least one scenario.
 11. The apparatus of claim 8 wherein theplurality of threads are to be modified within the managed run-timeenvironment (MRTE) on a per-thread basis.
 12. The apparatus of claim 11wherein the plurality of threads are to be modified and performedwithout first recompiling the plurality of threads.
 13. The apparatus ofclaim 10 wherein the profile is chosen from a group consisting of: hotcode profiling, cache miss profiling, cache miss and coherencyprofiling, and load latency profiling.
 14. The apparatus of claim 13wherein a scenario is chosen from a group consisting of: occurrence ofinstructions, loads with last level cache (LLC) miss, branches,un-halted core clocks, sampled loads, and snoops.
 15. A methodcomprising: monitoring performance of a processing resource, includingdetecting a plurality of scenarios occurring within the processingresource, each of the plurality of scenarios assigned to one of aplurality of channels each channel to store state informationcorresponding to an instruction thread, each channel having a differentpriority and specifying a trigger-action mapping for a scenarioassociated with the channel responsive to which a yield event is tooccur to transfer execution to a yield event service routine associatedwith the channel, the processing resource further including a blockindicator to provide an override of the yield event, wherein if multipleyield events occur simultaneously, a highest priority channel isselected for servicing; performing a fault-like or a trap-like yield inresponse to detecting the plurality of scenarios; generating a profileof information from the occurrence of the plurality of scenarios;optimizing the performance of a thread of instructions according to theprofile of information by translation of the profile of information intoa method to modify user code of the thread in real-time during run-timeof the thread, without recompiling the thread before the thread isperformed by the processing resource.
 16. The method of claim 15 whereinthe profile is used by a user model to optimize the performance of thethread.
 17. The method of claim 16 wherein the plurality of scenariosare generated from the combination of a plurality of triggering eventswithin the processing resource.
 18. A non-transitory machine-readablemedium having stored thereon a set of instructions, which if executed bya machine cause the machine to perform a method comprising: monitoringperformance of a processing resource, including detecting a plurality ofscenarios occurring within the processing resource, each of theplurality of scenarios assigned to one of a plurality of channels eachchannel to store state information corresponding to an instructionthread, each channel having a different priority and specifying atrigger-action mapping for a scenario associated with the channelresponsive to which a yield event is to occur to transfer execution to ayield event service routine associated with the channel, the processingresource further including a block indicator to provide an override ofthe yield event, wherein if multiple yield events occur simultaneously,a highest priority channel is selected for servicing; optimizing theperformance of a thread of instructions according to a profile ofinformation by translation of the profile of information into a methodto modify user code of the thread in real-time during run-time of thethread, without recompiling the thread before the thread is performed bythe processing resource.
 19. The non-transitory machine-readable mediumof claim 18 further comprising generating the profile of informationfrom the occurrence of the plurality of scenarios.
 20. Thenon-transitory machine-readable medium of claim 19 further comprising auser model to determine a manner in which the thread of instructions isto be modified.
 21. The non-transitory machine-readable medium of claim20 further comprising a managed run-time environment in which to modifythe thread of instructions.
 22. The non-transitory machine-readablemedium of claim 18 wherein the performance of the thread is to bemodified in a manner that is independent of an operating system runningon the processing resource.